package com.jtlrm.ckd.mvp.model;

import com.base.sdk.base.model.BaseModel;
import com.base.sdk.base.net.LifeCycleEvent;
import com.google.gson.JsonObject;
import com.jtlrm.ckd.entity.submitEntity.ShengHuaSubmitData;
import com.jtlrm.ckd.entity.submitEntity.UpdateShenHuaData;
import com.jtlrm.ckd.net.RetrofitUtil;

import io.reactivex.Observer;
import io.reactivex.subjects.PublishSubject;

public class ShuJuShenHeModel extends BaseModel {

    public void queryAddSuiFangList(String keyword, int pageIndex, int pageSize, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("keyword", keyword);
        jsonObject.addProperty("pageIndex", pageIndex);
        jsonObject.addProperty("pageSize", pageSize);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryDataShenHeList(jsonObject), observer, lifecycleSubject);
    }

    public void shenHe(String treatmentIds, String remark, int isPass, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("treatmentIds", treatmentIds);
        jsonObject.addProperty("remark", remark);
        jsonObject.addProperty("isPass", isPass);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().shenHeData(jsonObject), observer, lifecycleSubject);
    }

    public void queryShenHeDetail(String treatmentId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("treatmentId", treatmentId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryShuJuShenHeDetail(jsonObject), observer, lifecycleSubject);
    }
    public void queryShenHeDetailPic(String treatmentId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("treatmentId", treatmentId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryShuJuShenHeDetailPic(jsonObject), observer, lifecycleSubject);
    }

    public void updateShengHua(UpdateShenHuaData submitData, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().updateShengHua(createBody(submitData)), observer, lifecycleSubject);
    }

}
